package com.ccb.lms.service;

import java.sql.SQLException;
import java.util.List;

import com.ccb.lms.facade.FacadeDAO;
import com.ccb.lms.model.User;


public class UserService implements IUserService {
	
	private FacadeDAO facadeDAO=null;



	public FacadeDAO getFacadeDAO() {
		return facadeDAO;
	}

	public void setFacadeDAO(FacadeDAO facadeDAO) {
		this.facadeDAO = facadeDAO;
	}

	public boolean deleteUser(Integer id) {
		try {
			return facadeDAO.getUserDAO().deleteUser(id);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return false;
	}

	public List<User> getAllUser() {
		try {
			return facadeDAO.getUserDAO().getAllUser();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}

	public User getUserById(Integer id) {
		try {
			return facadeDAO.getUserDAO().getUserById(id);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}

	public boolean insertUser(User user) {
		try {
			return facadeDAO.getUserDAO().insertUser(user);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return false;
	}

	public boolean isLogin(User user) {
		try {
			return facadeDAO.getUserDAO().isLogin(user);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return false;
	}

	public boolean updateUser(User user) {
		try {
			return facadeDAO.getUserDAO().updateUser(user);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return false;
	}

}

